<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Class: ShaderAttribute</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Class: ShaderAttribute</h1>

    




<section>

<header>
    
        <h2>
            <span class="ancestors"><a href="SPE.html">SPE</a>.</span>
        
        ShaderAttribute
        </h2>
        
    
</header>

<article>
    <div class="container-overview">
    
        

    

    <h4 class="name" id="ShaderAttribute"><span class="type-signature"></span>new ShaderAttribute<span class="signature">(type, dynamicBuffer<span class="signature-attributes">opt</span>, arrayType<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>

    



<div class="description">
    A helper to handle creating and updating a THREE.BufferAttribute instance.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>type</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last">The buffer attribute type. See SPE.ShaderAttribute.typeSizeMap for valid values.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>dynamicBuffer</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last">Whether this buffer attribute should be marked as dynamic or not.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>arrayType</code></td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last">A reference to a TypedArray constructor. Defaults to Float32Array if none provided.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    
    <dt class="tag-author">Author:</dt>
    <dd class="tag-author">
        <ul>
            <li>Luke Moody</li>
        </ul>
    </dd>
    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="helpers_SPE.ShaderAttribute.js.html">helpers/SPE.ShaderAttribute.js</a>, <a href="helpers_SPE.ShaderAttribute.js.html#line10">line 10</a>
    </li></ul></dd>
    

    

    

    
</dl>
















    
    </div>

    

    

    

     

    

    
        <h3 class="subsection-title">Members</h3>

        
            
<h4 class="name" id=".typeSizeMap"><span class="type-signature">(static) </span>typeSizeMap<span class="type-signature"> :Number</span></h4>




<div class="description">
    A map of uniform types to their component size.
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Number</span>


        </li>
    </ul>





    <h5 class="subsection-title">Properties:</h5>

    

<table class="props">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>f</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">Float</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>v2</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">Vec2</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>v3</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">Vec3</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>v4</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">Vec4</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>c</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">Color</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>m3</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">Mat3</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>m4</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">Mat4</td>
        </tr>

    
    </tbody>
</table>




<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="helpers_SPE.ShaderAttribute.js.html">helpers/SPE.ShaderAttribute.js</a>, <a href="helpers_SPE.ShaderAttribute.js.html#line32">line 32</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    <h4 class="name" id="_createBufferAttribute"><span class="type-signature"></span>_createBufferAttribute<span class="signature">(size)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Creates a THREE.BufferAttribute instance if one doesn't exist already.

Ensures a typed array is present by calling _ensureTypedArray() first.

If a buffer attribute exists already, then it will be marked as needing an update.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>size</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The size of the typed array to create if one doesn't exist, or resize existing array to.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="helpers_SPE.ShaderAttribute.js.html">helpers/SPE.ShaderAttribute.js</a>, <a href="helpers_SPE.ShaderAttribute.js.html#line188">line 188</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="_ensureTypedArray"><span class="type-signature"></span>_ensureTypedArray<span class="signature">(size)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Make sure this attribute has a typed array associated with it.

If it does, then it will ensure the typed array is of the correct size.

If not, a new SPE.TypedArrayHelper instance will be created.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>size</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The size of the typed array to create or update to.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="helpers_SPE.ShaderAttribute.js.html">helpers/SPE.ShaderAttribute.js</a>, <a href="helpers_SPE.ShaderAttribute.js.html#line158">line 158</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="flagUpdate"><span class="type-signature"></span>flagUpdate<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Calculate the number of indices that this attribute should mark as needing
updating. Also marks the attribute as needing an update.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="helpers_SPE.ShaderAttribute.js.html">helpers/SPE.ShaderAttribute.js</a>, <a href="helpers_SPE.ShaderAttribute.js.html#line94">line 94</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="getLength"><span class="type-signature"></span>getLength<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4>

    



<div class="description">
    Returns the length of the typed array associated with this attribute.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="helpers_SPE.ShaderAttribute.js.html">helpers/SPE.ShaderAttribute.js</a>, <a href="helpers_SPE.ShaderAttribute.js.html#line211">line 211</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    The length of the typed array. Will be 0 if no typed array has been created yet.
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Number</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="resetUpdateRange"><span class="type-signature"></span>resetUpdateRange<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Reset the index update counts for this attribute
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="helpers_SPE.ShaderAttribute.js.html">helpers/SPE.ShaderAttribute.js</a>, <a href="helpers_SPE.ShaderAttribute.js.html#line112">line 112</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="setUpdateRange"><span class="type-signature"></span>setUpdateRange<span class="signature">(min, max)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Calculate the minimum and maximum update range for this buffer attribute using
component size independant min and max values.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>min</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The start of the range to mark as needing an update.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>max</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The end of the range to mark as needing an update.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="helpers_SPE.ShaderAttribute.js.html">helpers/SPE.ShaderAttribute.js</a>, <a href="helpers_SPE.ShaderAttribute.js.html#line83">line 83</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="splice"><span class="type-signature"></span>splice<span class="signature">(start, end)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Perform a splice operation on this attribute's buffer.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>start</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The start index of the splice. Will be multiplied by the number of components for this attribute.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>end</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">The end index of the splice. Will be multiplied by the number of components for this attribute.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="helpers_SPE.ShaderAttribute.js.html">helpers/SPE.ShaderAttribute.js</a>, <a href="helpers_SPE.ShaderAttribute.js.html#line129">line 129</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
    

    

    
</article>

</section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="SPE.Emitter.html">Emitter</a></li><li><a href="SPE.Group.html">Group</a></li><li><a href="SPE.ShaderAttribute.html">ShaderAttribute</a></li><li><a href="SPE.TypedArrayHelper.html">TypedArrayHelper</a></li></ul><h3>Namespaces</h3><ul><li><a href="SPE.html">SPE</a></li><li><a href="SPE.utils.html">utils</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.3</a> on Sat Nov 14 2015 15:30:50 GMT+0000 (GMT)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>